package com.tg.paw.ums.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tg.paw.ums.entity.Admin;
import com.tg.paw.ums.mapper.AdminMapper;
import com.tg.paw.ums.service.IAdminService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 管理员 服务实现类
 * </p>
 *
 * @author Rubble
 * @since 2020-10-21
 */
@Service
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements IAdminService {

    @Override
    public Admin getByOpenId(String openId) {
        return null;
    }

    @Override
    public Admin getByLoginUserName(String username) {
        LambdaQueryWrapper<Admin> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Admin::getAdminName,username);
        List<Admin> list = this.list(queryWrapper);
        if(!list.isEmpty()){
            return list.get(0);
        }

        return null;
    }
}
